<template>
  <div style="padding: 0 25px">
    <div>
      <div style="display: inline-block; vertical-align: middle">
        <span v-for="(item, index) in score"
              :key="item + index"
              class="star-five"></span>
        <span v-for="item in 0"
              :key="item"
              class="star-five gray"></span>
      </div>
      <span style="vertical-align: middle; margin-left: 30px"
            v-if="score">
        {{
          score === 1 || score === 2
            ? "很差"
            : score === 3
            ? "一般"
            : score === 4 || score === 5
            ? "非常好"
            : ""
        }}
      </span>
    </div>
    <div style="padding: 15px 0 0">
      <span v-for="(content, index) in scoreDesc"
            :key="index"
            class="evaluate_span">{{ content }}</span>
    </div>
  </div>
</template>

<script>
export default {
  name: "Evaluation",
  props: {
    orderDetails: {
      type: Object,
      default: () => { }
    }
  },
  computed: {
    score () {
      return this.orderDetails.score;
    },
    scoreDesc () {
      let desc = this.orderDetails.scoreDesc;
      return desc.split(",");
    }
  }
};
</script>

<style lang="scss" scoped>
.star-five {
  margin: 20px 0;
  position: relative;
  display: inline-block;
  color: #f5a724;
  width: 0px;
  height: 0px;
  margin-right: 15px;
  border-right: 9px solid transparent;
  border-bottom: 7px solid #f5a724;
  border-left: 9px solid transparent;
  -moz-transform: rotate(35deg);
  -webkit-transform: rotate(35deg);
  -ms-transform: rotate(35deg);
  -o-transform: rotate(35deg);

  &::before {
    border-bottom: 9px solid #f5a724;
    border-left: 3px solid transparent;
    border-right: 3px solid transparent;
    position: absolute;
    height: 0;
    width: 0;
    top: -5px;
    left: -5.8px;
    display: block;
    content: "";
    -webkit-transform: rotate(-35deg);
    -moz-transform: rotate(-35deg);
    -ms-transform: rotate(-35deg);
    -o-transform: rotate(-35deg);
  }

  &::after {
    position: absolute;
    display: block;
    color: #f5a724;
    top: 0;
    left: -9.5px;
    width: 0px;
    height: 0px;
    border-right: 9px solid transparent;
    border-bottom: 7px solid #f5a724;
    border-left: 9px solid transparent;
    -webkit-transform: rotate(-70deg);
    -moz-transform: rotate(-70deg);
    -ms-transform: rotate(-70deg);
    -o-transform: rotate(-70deg);
    content: "";
  }

  &.gray {
    color: #aaa !important;
    border-bottom-color: #aaa !important;

    &::before {
      border-bottom-color: #aaa !important;
    }

    &::after {
      color: #aaa !important;
      border-bottom-color: #aaa !important;
    }
  }
}

.evaluate_span {
  display: inline-block;
  padding: 6px 18px;
  background-color: var(--prev-color-primary);
  border-radius: 32px;
  color: var(--prev-bg-white);
  font-size: 14px;
  margin: 0 20px 20px 0;
}
</style>
